<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>使用$.getJSON()方法加载json文件</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$.getJSON("test.json",function(data){
			var htmlStr = "";
			$.each(data,function(index,info){
				htmlStr+="姓名："+info['name']+"<br/>";
				htmlStr+="性别："+info['sex']+"<br/>";
				htmlStr+="邮箱："+info['email']+"<br/><br/>";
			})
			$("#json").html(htmlStr);
		})
	})
</script>
</head>

<body>
<div id="json"></div>
</body>
</html>
